package com.zzq.mapper;

import com.zzq.pojo.BidInfo;
import com.zzq.pojo.vo.InformName;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface BidderInfoMapper {

    @Insert("insert into bid_info (bid_date,bidder,tenderer,legal_representative,contact_phone,tender_project_no,product_batch_no,production_date,expiration_date,bid_amount,deposit_payment_date,status) values(now(),#{bidder},#{tenderer},#{legalRepresentative},#{contactPhone},#{tenderProjectNo},#{productBatchNo},#{productionDate},#{expirationDate},#{bidAmount},#{depositPaymentDate},#{status})")
    void add(BidInfo bidInfo);

    @Select("select * from bid_info where tenderer=#{tenderer}")
    ArrayList<BidInfo> recommend(String tenderer);

    void updateBidStatus(String id, String status);

    @Select("select * from bid_info where bidder=#{name}")
    List<BidInfo> myBidderInfo(String name);

    @Select("select tender_project_no from bid_info where id=#{id}")
    String getTenderProjectNoById(String id);

    @Select("select tenderer,bidder,tender_project_no from bid_info where id=#{id}")
    InformName getNameById(String winnerId);
}
